"use client"
import { useState } from "react";
import { addTodo } from './actions';

export default function TodoPage() {
    const [input, setInput] = useState('');
    return (
        <>
            <form action={addTodo} className="flex gap-2 p-4">
                <input
                    name="title"
                    value={input}
                    onChange={e => setInput(e.target.value)}
                    placeholder="输入待办事项"
                    className="border rounded px-2 py-1 flex-1"
                    required
                />
                <button type="submit" className="bg-blue-500 text-white px-4 py-1 rounded">添加</button>
            </form>
        </>
    )
}